﻿using System;
using System.Collections.Generic;
using System.Text;
using GD.ModelContest.Service.Impl;
using GD.ModelContest.DataAccess.Impl.IBatisNet;

namespace GD.ModelContest.Service
{
    public class ServiceLocator
    {
        /// <summary>
        /// 构建INewsService
        /// </summary>       
        private static INewsService _inewsservice = null;

        public static INewsService INewsService
        {
            get
            {
                if (_inewsservice == null)
                {
                    _inewsservice = new NewsServiceImpl(new NewsSqlMapDao());
                }
                return _inewsservice;
            }
        }

        /// <summary>
        /// 构建IUserService
        /// </summary>       
        private static IUserService _iuserservice = null;

        public static IUserService IUserService
        {
            get
            {
                if (_iuserservice == null)
                {
                    _iuserservice = new UserServiceImpl(new UserSqlMapDao());
                }
                return _iuserservice;
            }
        }

        /// <summary>
        /// 构建IMessageService
        /// </summary>       
        private static IMessageService _imessageservice = null;

        public static IMessageService IMessageService
        {
            get
            {
                if (_imessageservice == null)
                {
                    _imessageservice = new MessageServiceImpl(new MessageSqlMapDao());
                }
                return _imessageservice;
            }
        }

        /// <summary>
        /// 构建IAdminService
        /// </summary>       
        private static IAdminService _iadminservice = null;

        public static IAdminService IAdminService
        {
            get
            {
                if (_iadminservice == null)
                {
                    _iadminservice = new AdminServiceImpl(new AdminSqlMapDao());
                }
                return _iadminservice;
            }
        }
    }
}
